package com.yc.vote.mapper;

import com.yc.vote.entity.TpRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 投票系统-投票记录表-6 Mapper 接口
 * </p>
 *
 * @author baomidou
 * @since 2023-07-10
 */
public interface TpRecordMapper extends BaseMapper<TpRecord> {

    @Insert("insert into tp_record values(default,#{vid},#{iid},#{uid})")
    void insert(@Param("vid") String vid,
                @Param("iid") String iid,
                @Param("uid") String uid);

    @Select("select count(*) cnt from tp_record" +
            " where vid=#{vid} and usid=#{uid}")
    int count(@Param("vid") String vid,
                @Param("uid") String uid);

}
